<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.jsj.servlet.ch6.ProductBean" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
  
	<%-- <%
		Object obj=pageContext.getAttribute("product");
		ProductBean product=null;
		if(obj == null){
			product=new ProductBean();
			pageContext.setAttribute("product",product);
		}else{
			product=(ProductBean)obj;
		}
		product.setNum(2);
		product.setPrice(10.2f);
	%>
	
	商品总价是：<%=product.getTotalPrice() %> --%>
	
	<jsp:useBean id="product" class="com.jsj.servlet.ch6.ProductBean" scope="page">
	</jsp:useBean>
	<jsp:useBean id="product2" class="com.jsj.servlet.ch6.ProductBean" scope="page">
	</jsp:useBean>
	
	<jsp:setProperty property="price" name="product" value="10.2f"/>
	<jsp:setProperty property="num" name="product" value="2"/>
	
	
	商品总价是：<jsp:getProperty property="totalPrice" name="product"/>

</body>
</html>